package view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;

import com.example.my.R;

public class ViewPagerIndicator extends LinearLayout {
    private int mCount;
    private int mCurrent;
    public ViewPagerIndicator(Context context,
                              @Nullable AttributeSet attrs) {
        super(context,attrs);
    }

    public void setCount(int count)
    {
        mCount = count;

    }
    public void setCurrent(int curr){
        removeAllViews();

        for (int i=0;i<mCount;++i){
        ImageView circle = new ImageView(getContext());
        if (curr == i)
        circle.setImageResource(R.drawable.indicator_on);
        else
            circle.setImageResource(R.drawable.indicator_off);
        circle.setPadding(5,0,5,0);
        addView(circle);

        }
    }
}

